﻿using System;
using System.Data;

namespace DAL
{
    public static class DalRecruitmentPlanMain
    {
        private static readonly clsConnect Cls = new clsConnect();
        #region[Get-Data]
        public static DataTable GetRecruitmentPlanMain(string keywords)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@KEYWORDS", keywords);
            return Cls.GetData("sp_Recruitment_Plan_Main_Get");
        }
        public static DataTable GetRecruitmentPlanMainFillter(string DateBegin,string DateEnd)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@DateBegin", DateBegin);
            Cls.AddParameter("@EndBegin", DateEnd);
            return Cls.GetData("sp_Recruitment_Plan_Main_GetFillter");
        }
        public static DataTable GetRecruitmentPlanMainEdit(int id)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@ID_Main", id);
            return Cls.GetData("sp_Recruitment_Plan_Main_Get_Edit");
        }
        #endregion

        #region[Insert-Update-Delete]
        public static bool Insert(EtRecruitmentPlanMain obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Main_Code", obj.Main_Code);
            Cls.AddParameter("@Main_Name", obj.Main_Name);
            Cls.AddParameter("@Datebegin", obj.Datebegin);
            Cls.AddParameter("@Quarters", obj.Quarters);
            Cls.AddParameter("@Years", obj.Years);
            Cls.AddParameter("@Users_Id", obj.Users_Id);
            Cls.AddParameter("@Department_Id", obj.Department_Id);
            Cls.AddParameter("@DateEnd", obj.DateEnd);
            return Cls.ExecuteNonQuery("sp_Recruitment_Plan_Main_Insert");
        }
        public static bool Update(EtRecruitmentPlanMain obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@ID_Main", obj.ID_Main);
            Cls.AddParameter("@Main_Code", obj.Main_Code);
            Cls.AddParameter("@Main_Name", obj.Main_Name);
            Cls.AddParameter("@Datebegin", obj.Datebegin);
            Cls.AddParameter("@Quarters", obj.Quarters);
            Cls.AddParameter("@Years", obj.Years);
            Cls.AddParameter("@Users_Id", obj.Users_Id);
            Cls.AddParameter("@Department_Id", obj.Department_Id);
            Cls.AddParameter("@DateEnd", obj.DateEnd);
            return Cls.ExecuteNonQuery("sp_Recruitment_Plan_Main_Update");
        }
        public static bool Delete(EtRecruitmentPlanMain obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@ID_Main", obj.ID_Main);
            return Cls.ExecuteNonQuery("sp_Recruitment_Plan_Main_Delete");
        }
        #endregion
    }

    public class EtRecruitmentPlanMain
    {
        public int ID_Main { get; set; }
        public string Main_Code { get; set; }
        public string Main_Name { get; set; }
        public DateTime Datebegin { get; set; }
        public DateTime DateEnd { get; set; }
        public int Quarters { get; set; }
        public int Years { get; set; }
        public int Users_Id { get; set; }
        public int Department_Id { get; set; }
    }
}